﻿<UserControl x:Class="Topics.Radical.Presentation.DragAndDrop.DragAndDropSampleView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             xmlns:behaviors="http://schemas.topics.it/wpf/radical/windows/behaviors"
             xmlns:markup="http://schemas.topics.it/wpf/radical/windows/markup"
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="5*"/>
            <ColumnDefinition Width="5*"/>
        </Grid.ColumnDefinitions>
        
        <ListBox ItemsSource="{Binding Path=LeftPersons}" 
                 behaviors:DragDropManager.OnDropCommand="{markup:AutoCommandBinding Path=DropPerson}"
                 SelectedItem="{Binding Path=LeftSelectedPerson}">
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="behaviors:DragDropManager.DataObject" Value="{Binding}" />
                    <Setter Property="behaviors:DragDropManager.DataObjectType" Value="left/person" />
                </Style>
            </ListBox.ItemContainerStyle>
        </ListBox>

        <ListBox ItemsSource="{Binding Path=RightPersons}"
                 behaviors:DragDropManager.OnDropCommand="{markup:AutoCommandBinding Path=DropPerson}"
                 SelectedItem="{Binding Path=RightSelectedPerson}" Grid.Column="1">
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="behaviors:DragDropManager.DataObject" Value="{Binding}" />
                    <Setter Property="behaviors:DragDropManager.DataObjectType" Value="right/person" />
                </Style>
            </ListBox.ItemContainerStyle>
        </ListBox>

    </Grid>
</UserControl>
